public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String s1 = sc.nextLine();
            String s2 = sc.nextLine();
            if(s1.length() < s2.length()){
                System.out.println(getCommonStrLength(s1,s2));
            }else{
                System.out.println(getCommonStrLength(s2,s1));
            }
        }
        sc.close();
    }
    
    public static int getCommonStrLength(String str1, String str2){
        int maxLength = 0;
        for(int i = 0; i < str1.length(); i++){
            for(int j = i+1; j < str1.length(); j++){
                String str = str1.substring(i,j);
                if(str2.contains(str)){
                    maxLength = str.length() > maxLength ? str.length() : maxLength;
                }
            }
        }
        return maxLength;
    }
}